﻿using System;
using System.Linq;
using System.Xml.Linq;
using System.Net.Http;
using OurDailyBread.Helpers;
using Windows.Data.Json;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using System.Net.Http.Headers;
using Newtonsoft.Json.Converters;

namespace OurDailyBread.Model
{
    public class MyLikeDataService : IMyLikeDataService
    {

        public void GetData(Action<Object, Exception> callback)
        {
            // Use this to connect to the actual data service
            try
            {
                Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
                //roamingSettings.Values.Remove("MyLikes");
                string myLikeListString = (string)roamingSettings.Values["MyLikes"];
                callback(myLikeListString, null);
            }
            catch (Exception ex)
            {
                callback(null, ex);
            }

        }

        public void PutData(string roamData, Action<Object, Exception> callback)
        {
            // Use this to connect to the actual data service
            try
            {
                Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
                roamingSettings.Values["MyLikes"] = roamData;
                callback("success", null);
            }
            catch (Exception ex)
            {
                callback(null, ex);
            }

        }
    }
}